<template>
  <div id="lineContainer"></div>
</template>

<script>
// 导入必要模块
import * as echarts from "echarts/core";
import { GridComponent } from "echarts/components";
import { LineChart } from "echarts/charts";
import { UniversalTransition } from "echarts/features";
import { CanvasRenderer } from "echarts/renderers";

echarts.use([GridComponent, LineChart, CanvasRenderer, UniversalTransition]);

// 配置项
const option = {
  xAxis: {
    type: "category",
    data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
  },
  yAxis: {
    type: "value",
  },
  series: [
    {
      data: [820, 932, 901, 934, 1290, 1330, 1320],
      type: "line",
      smooth: true,
    },
  ],
};

export default {
  name: "LineGraph",
  mounted() {
    const chartDom = document.getElementById("lineContainer");
    const myChart = echarts.init(chartDom);
    myChart.setOption(option);
  },
};
</script>

<style scoped>
#lineContainer{
    width: 50%;
    height: 400px;
}
</style>